import request  from "@/utils/request.js";

/**
 * 获取列表
 * @param params
 * @returns {*}
 */
export function getList(params) {
  return request({
    url: '/device/cabinet/list',
    method: 'get',
    params: params
  })
}

/**
 * 查询编号
 * @returns {*}
 */
export function getCode() {
  return request({
    url: '/device/cabinet/getCode',
    method: 'get'
  })
}

/*柜机类型全查*/
export function allCheck(){
    return request({
        url: '/device/cabinetType/allCheck',
        method: 'get',
    })
}

// 查询充电宝柜机详细
export function getCabinet(id) {
    return request({
        url: '/device/cabinet/' + id,
        method: 'get'
    })
}

// 新增充电宝柜机
export function addCabinet(data) {
    return request({
        url: '/device/cabinet',
        method: 'post',
        data: data
    })
}

// 修改充电宝柜机
export function updateCabinet(data) {
    return request({
        url: '/device/cabinet',
        method: 'put',
        data: data
    })
}

export function delCabinet(ids) {
    return request({
        url: '/device/cabinet',
        method: 'delete',
        data: ids, // 将 ids 包装成对象
    });
}

// 获取充电宝柜机全部详细信息
export function getAllInfo(id) {
    return request({
        url: '/device/cabinet/getAllInfo/' + id,
        method: 'get'
    })
}

//搜索未使用柜机
export function searchNoUseList(keyword) {
    return request({
        url: '/device/cabinet/searchNoUseList/' + keyword,
        method: 'get'
    })
}

export function deletedms(id){
    return request({
        url: '/device/cabinet/' + id,
        method: 'delete'
    })
}